<template>
  <div>
    <el-container class="container">
      <el-header class="header">
        <span style="position: absolute;top: 10px"><a class="title">SHOP</a></span>
        <el-menu style="float: right"
                 mode="horizontal"
                 background-color="#545c64"
                 text-color="#fff"
                 active-text-color="#ffd04b">
          <el-submenu index="1">
            <template slot="title">
              <el-avatar size="small" :src="circleUrl"></el-avatar>
              Admin
            </template>
            <el-menu-item index="1-1">个人中心</el-menu-item>
            <el-menu-item index="1-2" @click="goIndex">返回首页</el-menu-item>
          </el-submenu>
        </el-menu>
      </el-header>
      <el-container class="container_aside">
        <!--侧边布局-->
        <el-aside>
          <el-menu
            :default-active="aisdeBarActive"
            @select="asideSelect">
            <el-menu-item index="1">
              <i class="el-icon-menu"></i>
              <span slot="title">首页</span>
            </el-menu-item>
            <el-menu-item index="2">
              <i class="el-icon-document"></i>
              <span slot="title">添加商品</span>
            </el-menu-item>
            <el-menu-item index="3">
              <i class="el-icon-document"></i>
              <span slot="title">商品列表</span>
            </el-menu-item>
          </el-menu>
        </el-aside>
        <!--主内容-->
        <el-main>
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>

export default {
  name: 'shop',
  data () {
    return {
      aisdeBarActive: '1',
      circleUrl: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
    }
  },
  methods: {
    handleSelect (key, keyPath) {
      console.log(key, keyPath)
    },
    asideSelect (key, keyPath) {
      console.log(key, keyPath)
      switch (key) {
        case '1':
          this.$router.push('/shopIndex')
          break
        case '2':
          this.$router.push('/shopAdd')
          break
        case '3':
          this.$router.push('/shopList')
          break
      }
    },
    goIndex () {
      this.$router.replace('/index')
    }
  }
}
</script>

<style scoped>
.container {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  /*设置超出隐藏*/
  overflow: hidden;
}

.container_aside {
  height: 100%;
  padding-bottom: 60px;
}

.header {
  background-color: #545c64;
}

.title {
  color: #fffF;
  font-size: 20px;
}

</style>
